package com.woniu.smallmedical.server.serverimpl;

import com.woniu.smallmedical.entity.*;
import com.woniu.smallmedical.mapper.GraphInfoMapper;
import com.woniu.smallmedical.server.GraphInfoServer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author author
 * @create 2021-10-08-14:59
 */
@Service
public class GraphInfoServerImpl implements GraphInfoServer {
    @Autowired
    GraphInfoMapper graphInfoMapper;
    @Override
    public List<GraphInfo> GetCountGrapInfoGender(DateStartEnd dateStartEnd) {

        List<GraphInfo> graphInfos = graphInfoMapper.selectCountPatientInfoGender(dateStartEnd);
        System.out.println(graphInfos);
        return graphInfos;
    }

    @Override
    public List<GraphInfo> getCountGrapInfoAge(DateStartEnd dateStartEnd) {
        List<GraphInfo> graphInfos = graphInfoMapper.selectCountPatientInfoAge(dateStartEnd);
        return graphInfos;
    }

    @Override
    public int getCountRegistration(DateStartEnd dateStartEnd) {
        int i = graphInfoMapper.selectCountRegistration(dateStartEnd);
        return i;
    }

    @Override
    public int getCountPatient(DateStartEnd dateStartEnd) {
        int i = graphInfoMapper.selectCountPatient(dateStartEnd);
        return i;
    }

    @Override
    public PageBean<ClincLog> getClincLog(DateStartEnd dateStartEnd,  Integer pageIndex, Integer pageSize) {
        List<ClincLog> clincLogs = graphInfoMapper.selectClincLog(dateStartEnd, pageIndex, pageSize);
        System.out.println(clincLogs);
        PageBean<ClincLog> pageBean=new PageBean<ClincLog>();
        int countClincLog = getCountClincLog(dateStartEnd);
        pageBean.setPageBeanList(clincLogs);
        pageBean.setPageIndex(pageIndex);
        pageBean.setPageSize(pageSize);
        pageBean.setTotalRecord(countClincLog);
        return pageBean;
    }

    @Override
    public int getCountClincLog(DateStartEnd dateStartEnd) {
        int i = graphInfoMapper.countClincLog(dateStartEnd);
        return i;
    }

    @Override
    public List<User> getDoctor() {
        List<User> doctors=graphInfoMapper.selectDoctor();
        return doctors;
    }

    @Override
    public List<Flow> getFlow() {
        List<Flow> flow=graphInfoMapper.selectFlow();
        return flow;
    }
}
